const app = getApp()

Page({
  data: {
    barMarginTop: '16',
    barHeight: '52',
    barWidth: '0',
    scrollHeight: '',
    img_root: app.img_root,
    calendarData: {
      year: new Date().getFullYear(),
      month: new Date().getMonth() + 1,
      dataSource: ['2021-03-17'],
      showSigned: false,
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getBarHeight()
    this.setListHeight()
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    app.setTabBar(this,0)
  },

  /**
   * 设置导航栏高度
   */
  getBarHeight() {
    let systemInfo = wx.getSystemInfoSync()
    let	statusBarHeight = systemInfo.statusBarHeight
    let menu = wx.getMenuButtonBoundingClientRect()

    let	barMarginTop = menu.top
    let	barHeight = menu.height + 10
    let barWidth = systemInfo.windowWidth - (systemInfo.windowWidth - menu.right + menu.width)

    this.setData({
      barMarginTop: barMarginTop,
      barHeight: barHeight,
      barWidth: barWidth
    })
  },

  /**
   * 设置scroll-view高度
   */
  setListHeight() {
    let systemInfo = wx.getSystemInfoSync(),
      rpx = systemInfo.windowWidth / 750, // 计算rpx
      hei = parseInt(this.data.barMarginTop) + parseInt(this.data.barHeight) + 4,
      tapHeight = Math.floor(rpx * hei * 2), // tap高度
      scrollHeight = systemInfo.windowHeight - tapHeight; // swiper高度
    this.setData({
      scrollHeight
    });
  },

  bindDownLoad() {},
})
